<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery.js"></script>
    <script>
        window.onload=function (){
            $.ajax({
                success:function (data){
                    let str=` <tr>
                        <td>部门编号</td>
                        <td>部门名称</td>
                        <td>位置</td>
                        <td>姓名</td>
                        <td>图片</td>
                    </tr>`;
                    //第一个参数为对象数组  第二个参数为回调函数
                    $.each(data,function (i,obj){
                        str+=`<tr>
                        <td>${obj.deptno}</td>
                         <td>${obj.dname}</td>
                        <td>${obj.loc}</td>`;
                        // if(obj.e)
                        $.each(obj.e,function(j,o){
                            str += `<td>${o.ename}</td>
                        <td><img src="${url}upload/${o.epic}"/></td>`;
                        });
                        str+=`</tr>`;
                    }

                );
                    //替换
                    $("table").html(str);
                },
                url:url+"emp/alldept"
            })
        }
    </script>
    <script src="js/common.js"></script>
</head>
<body>
<table>

</table>
</body>
</html>